package gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;


public class PantallaGeneral extends FormPage {
	
	private Text nombre;
	private Text edad;
	private Text sintomas;
	private Text identificacion;
	private Text sistolica;
	private Text diastolica;
	private Text text_2;
	private Text temp;
	private Text pulso;
	private Text oxigeno;
	private Text apellido;
	private Text text;

	/**
	 * Create the form page.
	 * @param id
	 * @param title
	 */
	public PantallaGeneral(String id, String title) {
		super(id, title);
	}

	/**
	 * Create the form page.
	 * @param editor
	 * @param id
	 * @param title
	 * @wbp.parser.constructor
	 * @wbp.eval.method.parameter id "Some id"
	 * @wbp.eval.method.parameter title "Some title"
	 */
	public PantallaGeneral(FormEditor editor, String id, String title) {
		super(editor, id, title);
	}

	/**
	 * Create contents of the form.
	 * @param managedForm
	 */
	@Override
	protected void createFormContent(IManagedForm managedForm) {
		managedForm.getForm().setToolTipText("ingresar Apellido del Paciente");
		FormToolkit toolkit = managedForm.getToolkit();
		ScrolledForm form = managedForm.getForm();
		form.setText("SAER- Emergentolog\u00ECa");
		Composite body = form.getBody();
		toolkit.decorateFormHeading(form.getForm());
		toolkit.paintBordersFor(body);
		
		Button btnEnviar = managedForm.getToolkit().createButton(managedForm.getForm().getBody(), "Enviar", SWT.NONE);
		btnEnviar.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				/**@TODO realizar la accion correpondiente en el enviar*/
			}
		});
		btnEnviar.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
			}
		});
		btnEnviar.setBounds(709, 501, 75, 25);
		
		Label lblNombre = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Nombre", SWT.NONE);
		lblNombre.setBounds(10, 89, 55, 18);
		
		Label lblApellidoPaciente = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Edad", SWT.NONE);
		lblApellidoPaciente.setBounds(10, 123, 50, 15);
		
		Label lblSexo = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Sexo", SWT.NONE);
		lblSexo.setBounds(271, 123, 30, 15);
		
		nombre = managedForm.getToolkit().createText(managedForm.getForm().getBody(), "New Text", SWT.NONE);
		nombre.setText("");
		nombre.setBounds(71, 86, 165, 21);
		
		edad = managedForm.getToolkit().createText(managedForm.getForm().getBody(), "New Text", SWT.NONE);
		edad.setText("");
		edad.setBounds(66, 120, 133, 21);
		
		Section sctnNewSection = managedForm.getToolkit().createSection(managedForm.getForm().getBody(), Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
		sctnNewSection.setBounds(0, 58, 784, 25);
		managedForm.getToolkit().paintBordersFor(sctnNewSection);
		sctnNewSection.setText("DATOS PACIENTE");
		sctnNewSection.setExpanded(true);
		
		Label lblGlucosaEnSangre = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Nivel de Glucosa", SWT.NONE);
		lblGlucosaEnSangre.setBounds(23, 211, 106, 15);
		
		Label lblSistolica = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Sistolica", SWT.NONE);
		lblSistolica.setBounds(23, 255, 55, 15);
		
		Label lblNewLabel = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Diastolica", SWT.NONE);
		lblNewLabel.setBounds(23, 290, 55, 15);
		
		Section sctnEnfermero = managedForm.getToolkit().createSection(managedForm.getForm().getBody(), Section.TWISTIE | Section.TITLE_BAR);
		sctnEnfermero.setBounds(0, 10, 784, 21);
		managedForm.getToolkit().paintBordersFor(sctnEnfermero);
		sctnEnfermero.setText("DATOS ENFERMERO");
		sctnEnfermero.setExpanded(true);
		
		Section sctnMediciones = managedForm.getToolkit().createSection(managedForm.getForm().getBody(), Section.TWISTIE | Section.TITLE_BAR);
		sctnMediciones.setBounds(0, 163, 794, 21);
		managedForm.getToolkit().paintBordersFor(sctnMediciones);
		sctnMediciones.setText("DATOS CLINICOS");
		sctnMediciones.setExpanded(true);
		
		Group grpGrupo = new Group(managedForm.getForm().getBody(), SWT.NONE);
		grpGrupo.setText("S\u00EDntomas");
		grpGrupo.setBounds(10, 430, 219, 82);
		managedForm.getToolkit().adapt(grpGrupo);
		managedForm.getToolkit().paintBordersFor(grpGrupo);
		
		sintomas = managedForm.getToolkit().createText(grpGrupo, "New Text", SWT.NONE);
		sintomas.setText("");
		sintomas.setBounds(0, 20, 219, 62);
		
		Label lblIdentifacion = managedForm.getToolkit().createLabel(managedForm.getForm().getBody(), "Identificaci\u00F3n", SWT.NONE);
		lblIdentifacion.setBounds(10, 37, 82, 15);
		
		identificacion = managedForm.getToolkit().createText(managedForm.getForm().getBody(), "New Text", SWT.NONE);
		identificacion.setText("");
		identificacion.setBounds(98, 31, 165, 21);
		
		Button btnFemenino = new Button(managedForm.getForm().getBody(), SWT.RADIO);
		btnFemenino.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
			}
		});
		btnFemenino.setBounds(334, 122, 82, 16);
		managedForm.getToolkit().adapt(btnFemenino, true, true);
		btnFemenino.setText("Femenino");
		
		Button btnMasculino = new Button(managedForm.getForm().getBody(), SWT.RADIO);
		btnMasculino.setBounds(417, 122, 90, 16);
		managedForm.getToolkit().adapt(btnMasculino, true, true);
		btnMasculino.setText("Masculino");
		
		sistolica = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		sistolica.setBounds(134, 252, 76, 21);
		managedForm.getToolkit().adapt(sistolica, true, true);
		
		diastolica = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		diastolica.setBounds(134, 287, 76, 21);
		managedForm.getToolkit().adapt(diastolica, true, true);
		
		text_2 = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		text_2.setBounds(134, 211, 76, 21);
		managedForm.getToolkit().adapt(text_2, true, true);
		
		Label lblTemperatura = new Label(managedForm.getForm().getBody(), SWT.NONE);
		lblTemperatura.setBounds(23, 327, 75, 15);
		managedForm.getToolkit().adapt(lblTemperatura, true, true);
		lblTemperatura.setText("Temperatura");
		
		temp = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		temp.setBounds(134, 324, 76, 21);
		managedForm.getToolkit().adapt(temp, true, true);
		
		Label lblPulso = new Label(managedForm.getForm().getBody(), SWT.NONE);
		lblPulso.setBounds(23, 366, 55, 15);
		managedForm.getToolkit().adapt(lblPulso, true, true);
		lblPulso.setText("Pulso");
		
		pulso = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		pulso.setBounds(134, 363, 76, 21);
		managedForm.getToolkit().adapt(pulso, true, true);
		
		Label lblOxigeno = new Label(managedForm.getForm().getBody(), SWT.NONE);
		lblOxigeno.setBounds(23, 387, 55, 15);
		managedForm.getToolkit().adapt(lblOxigeno, true, true);
		lblOxigeno.setText("Oxigeno");
		
		oxigeno = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		oxigeno.setBounds(134, 390, 76, 21);
		managedForm.getToolkit().adapt(oxigeno, true, true);
		
		Group grpEcg = new Group(managedForm.getForm().getBody(), SWT.NONE);
		grpEcg.setText("ECG");
		grpEcg.setBounds(296, 237, 435, 226);
		managedForm.getToolkit().adapt(grpEcg);
		managedForm.getToolkit().paintBordersFor(grpEcg);
		
		Button btnEcg = new Button(managedForm.getForm().getBody(), SWT.NONE);
		btnEcg.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				//hacer panel para leer archivo
				//cargarelectro();
			}
		});
		btnEcg.setBounds(633, 206, 75, 25);
		managedForm.getToolkit().adapt(btnEcg, true, true);
		btnEcg.setText("ECG");
		
		Label lblApellido = new Label(managedForm.getForm().getBody(), SWT.NONE);
		lblApellido.setBounds(273, 92, 55, 15);
		managedForm.getToolkit().adapt(lblApellido, true, true);
		lblApellido.setText("Apellido");
		
		apellido = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		apellido.setBounds(334, 86, 165, 21);
		managedForm.getToolkit().adapt(apellido, true, true);
		
		Label lblDni = new Label(managedForm.getForm().getBody(), SWT.NONE);
		lblDni.setBounds(537, 92, 30, 15);
		managedForm.getToolkit().adapt(lblDni, true, true);
		lblDni.setText("DNI");
		
		text = new Text(managedForm.getForm().getBody(), SWT.BORDER);
		text.setBounds(573, 86, 106, 21);
		managedForm.getToolkit().adapt(text, true, true);
	}
}
